package io.openbas.collectors.expectations_vulnerability_manager;

import io.openbas.integrations.CollectorService;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
@Slf4j
public class ExpectationsVulnerabilityManagerCollector {

  private final CollectorService collectorService;
  public static final String EXPECTATIONS_VULNERABILITY_COLLECTOR_ID =
      "acab8214-0379-448a-a575-05e9d934eadd";
  public static final String EXPECTATIONS_VULNERABILITY_COLLECTOR_TYPE =
      "openbas_expectations_vulnerability_manager";
  public static final String EXPECTATIONS_VULNERABILITY_COLLECTOR_NAME =
      "Expectations Vulnerability Manager";

  @PostConstruct
  public void init() {
    try {
      collectorService.register(
          EXPECTATIONS_VULNERABILITY_COLLECTOR_ID,
          EXPECTATIONS_VULNERABILITY_COLLECTOR_TYPE,
          EXPECTATIONS_VULNERABILITY_COLLECTOR_NAME,
          getClass().getResourceAsStream("/img/icon-expectations-vulnerability-manager.png"));
    } catch (Exception e) {
      log.error("Error creating expectations vulnerability manager ", e);
    }
  }
}
